/*
 * Copyright (c) 2010 the original author or authors
 * 
 * Permission is hereby granted to use, modify, and distribute this file 
 * in accordance with the terms of the license agreement accompanying it.
 */
package com.colorhook.twitterair.controller{
	
	import com.colorhook.twitterair.model.SystemModel;
	import com.colorhook.twitterair.services.ILogService;
	import com.colorhook.twitterair.view.UIEvent;
	import com.colorhook.twitterair.vo.UserPreferences;
	
	import org.robotlegs.mvcs.Command;

	public class LoginSuccessCommand extends Command{
		
		[Inject]public var logService:ILogService;
		[Inject]public var systemModel:SystemModel;
		
		override public function execute():void{
			logService.info("LoginSuccessCommand execute");
			var event2:UIEvent=new UIEvent(UIEvent.SAVE_USER_PREFERENCES);
			var userPref:UserPreferences=new UserPreferences;
			userPref.username=systemModel.username;
			userPref.password=systemModel.password;
			userPref.autoLogin=systemModel.autoLogin;
			event2.userPref=userPref;
			this.dispatch(event2);
		}
	}
}